home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-02-28 | 15.9 KB | 313 lines | [TEXT/ttxt] |
- ** httpd4Mac v12a **
-
- Thank you for taking an interest in 'httpd4Mac' (for Macintosh) now at version ALPHA 1.2.
- This program used to be called just 'httpd', but that caused some confusion, so I have
- renamed it 'httpd4Mac'. 'httpd4Mac is a simple program that allows you to use your Mac as
- a WWW server.
-
- WARRANTY
-
- This program is supplied free with absolutely no warranty and may do unthinkable damage
- to your machine or data, for which I will accept no liability. Having said that, I didn't write
- it to do that, but you must satisfy yourself it will not do any damage before using it.
-
- You can do whatever you want with it except:-
-
- - Distribute it without this file 'About httpd v12a'
- - Charge money for it (duplication/floppy costs excluded)
-
- ABOUT HTTPD
-
- 'httpd4Mac' is an fba (Faceless Background Application) that implements a minimal http server.
- It currently supports the GET and HEAD methods, with full or simple requests. It ignores
- 'Accept' fields from the client. NB The http spec does not allow such a thing as a simple
- HEAD request. The only simple method is GET. But seeing as the CERN server accepts it (and
- the guy who invented WWW wrote that program) I thought I should also.
-
- WHAT DOES THAT MEAN ?
-
- That means it should work as a fairly straightforward WWW server. You should be able to write pages
- with images, and have separate image, sound and movie files. What it does not (yet) support are
- clickable images or forms and other interactive pages. I may write the code to support this later
- but it is not planned at the moment. I have tried using MacWeb and X-Mosaic and X-Netscape to retreive pages and they appear to work OK.
-
- A Faceless-Background-App (FBA or Background-Only-App (BOA) as the name suggests runs in the
- background. When you launch it you will see it go grey, but it will not appear to have run.
- No menu will appear, nor will any windows. It will not appearin the application menu either.
- This is perfectly normal, but unless you set the prefs file to notify you about major events,
- you will not know if it is running or not.
-
- At some stage I may code a foreground version which will have a menu and text window. This
- will not be available for some time though.
-
- WHY HTTPD4MAC ?
-
- There is one other http server I know of for the Mac which is not free. The aim of 'httpd4Mac'
- is to provide a free http server, which implements enough to serve out pages on your mac,
- without it putting an enormous load on the machine. It is designed to be lightweight
- and fast.
-
- It may not be much good if you expect to have loads of pages and images, or if you want to
- do more than just serve out static pages of HTML. At this stage I do not know how many pages
- and what sort of load it can reasonably handle. Perhaps someone could tell me how it fares.
-
- It is not a port of either CERN's or NCSA's for UNIX. It does not use the common code library.
- The only reason I gave it a similar name was because I couldn't be bothered to think of a
- diferent one.
-
- MACHINE
-
- You will need a Mac running at least Sys 7, with MacTCP version 2.xx an internet connection
- and preferably a hard disk. I think that should do it.
-
- RUNNING IT
-
- Just launch it. It will look for its config/prefs file firstly in its own folder, then in the
- system/prefs folder. If it does not find it, it creates it own from default info and quits.
- This default prefs file can be edited to set up httpd4Mac how you want. The app will still
- look 'greyed out' as if it is still running. This is normal. Just double click it again
- when you wish to re-launch.
-
- You will find this self-created prefs file in the preferences folder (within System folder)
- You can place this prefs files in the same folder as httpd4Mac or leave it in the prefs folder.
- I prefer keeping it with the app. Re-launch when you have edited the prefs file.
-
- Use a text editor to edit the prefs file. There are comments within it to help you. It
- would probably help if you knew a bit about servers, http etc, but the sample prefs will work
- so if you know nothing except how to write WWW pages then you could just re-launch. Apologies
- for the fact that some of the configuration options don't work yet. Occasionally I refer to
- the prefs file as a config file, but I'll try to avoid that.
-
- MORE ABOUT THE PREFS FILE DIRECTIVES
-
- dnr - This option tells httpd4Mac to do a reverse DNS look up on each connection it receives when
- logging. If you are not logging this makes no difference. If this option is off the
- server may run a bit faster. If an error occurs, then only the IP number will be recorded.
- Log info is actually queued while the client request is being serviced, the actual
- writing to a log file being deferred until later. Should httpd4Mac be forced to shut
- down beofre all logging is complete, it is rushed through without looking up names, so
- you may find just a list of numbers occasionally at the end of the log file.
-
- mime_def -
- Allows you to associate siffices and/or Mac file Types with a MIME Type, read about
- MIME below.
-
- create_access_log -
- Attempts to create a new log file each time httpd4Mac is launched. If it
- fails logging is disabled. If an old file exists it is renamed with a .bak extension. If this
- renaming process fails then logging is disabled. If this option is off, then logging merely
- continues from the end of the old file if it exists.
-
- ABOUT MIME
-
- MIME stands for Multipurpose Internet Mail Extensions. While most operating Systems now revolve
- around the idea of a file as a basic unit of storage on a disk, none has really defined
- a standard way of identifying a particular file type or format. Various OS have their own
- methods though. Apple incorporates a file type into the file header, meaning you can have
- any file name and change it, but the contents are still regarded by the OS as having not changed.
- UNIX users rely on file suffices (eg .html) and sad DOS users rely on 3-letter
- suffices (eg .htm) Mac users can also use suffices if they want.
-
- The idea of MIME (I think) was to fill that gap and provide a OS-Independent method of
- identifying information types, like GIF image files for instance. RFCs 1521 - 1524 describe
- MIME, but it was really meant not to be incorporated into OS, but used when transferring
- files from machine to machine by E-Mail.
-
- As the World Wide Web uses many different file types and should be almost platform independent
- I guess it may sense for the designers to choose MIME. In fact the http spec allows for
- a MIME dialogue to take place between client and server, with the client saying 'I know about
- xxx format' and the server saying 'The file you are getting is xxx format'
-
- The idea of the mime_def directive is for you to tell httpd4Mac what suffices and/or what
- filetypes you are associating with what type of MIME format. Some examples are given in the
- sample prefs file. When httpd4Mac receives a request it works its way through the list of
- mime_def directives, until it finds a match. Unless you know exactly what type of Mac
- file your scanner software produces, you may want to just stick with suffices. Mac text files
- always have a file type of 'TEXT' though. httpd4Mac alway slips in a default def of
- AnyFileType & AnySuffix = text/plain, for those types that do not match at the end of the list.
-
- You can put a wildcard character (*) in the mime_def line to match against anything.
-
- httpd4Mac converts all URLs it receives into lower case and then attempts to match to a MIME
- def. Make sure you suffices are in lower case !
-
- NB There are some MIME types which have 'application' in them. You cannot use most of these with
- httpd4Mac to deliver a Mac application to a client. This is because a Mac application uses
- both the resource and data fork of the file, but httpd4Mac serves only the data fork. What
- you have to do is convert the app to a bin-hex text file and define a MIME type that maps
- .hqx to application/mac-binhex40.
-
- MULTIPLE INSTANCES OF HTTPD4MAC
-
- Just copy http4Macd for each 'server' you wish to run. Place the copies in separate folders and
- create separate prefs files, also placing these in the folders. Set them up to run on different
- TCP ports and then launch them all.
-
- Make sure you set them up to serve on different TCP ports. Although it will not detect multiple
- servers on the same port and will appear to run fine, you may get some unexpected results.
-
- WWW FILES
-
- httpd4Mac can potentially serve any file in the same folder as the app. This is the same if you
- launch it by means of an alias (Say by putting an alias in the startup items folder), the files
- served will be only those in the same folderas the app. If the URL '/' is requested (ie
- 'http://host.name/') httpd4Mac looks for the file 'home.html'.
-
- '/' delimiters in the URL indicate sub-dirs in the usual manner (even though the specs say
- the use of the same delimter as is used for UNIX directories is co-incidence)
-
- You can happily use the '.' and '..' format for relative URLs, well, with the clients
- I tried anyway. You cannot (yet) put folder aliases in the app folder to serve out files from
- elsewhere. All httpd4Mac understands at the moment is normal folders and files. It does not
- distinguish between text, sound, or image files, or by file type or creator, or suffix.
-
- Make sure of course that sound/image files you serve out match what the client expects, the
- stadard format seems to be Sun ULaw sounds format and GIF image format.
-
- HOW DO I WRITE WWW PAGES
-
- If you don't know I'm not going to explain it here. There are places you can find out though.
- I would suggest looking in CERN's WWW pages as that is where it all started. Alternatively
- try NCSA (http://info.cern.ch/ or http://www.ncsa.uiuc.edu/)
-
- WWW pages are actually just text file written in a language called HTML, and include pointers
- to the image and sounds files etc. These files can be local to the machine or served out from
- a remote machine. Some client programs like MacWeb, come with local files written in HTML
- explaining how to set it up. These are often set up as the home page as default. You'll
- get an idea about HTML simply by looking at those files with a text editor.
-
- LIKELY IMPROVEMENTS LEADING UP TO v13 (ROUGHLY IN ORDER OF IMPORTANCE)
-
- - Error logging
- - Prevent serving out of logs and prefs file etc.
- - Clickable image support
- - Support for Finder aliases (+ maybe remote volumes)
-
- POSSIBLE IMPROVEMENTS FOR A LATER RELEASE (ROUGHLY IN ORDER OF IMPORTANCE)
-
- - Speed improvements
- - Various cache improvements
- - Understand client accept fields and act on them, maybe
- - Do prefs file syntax check
- - A version that runs in foreground and prints log output to a window.
- - A configuration program with proper User Interface to allow easy configuration. May allow
- remote changing of configuration by Program Linking.
-
- WHAT IT MAY NEVER DO.... (Depends if I can be bothered)
-
- - Support Applescript or anything that might be needed for interactive pages ie
- Search Functions
-
- - Support additional methods.(eg POST for fill out forms)
-
- MEMORY PARTITION
-
- The partition is set at 500K. In fact httpd4Mac may run in a partition
- of ~200K + size of largest file expected to be served out by httpd4Mac. ie If you have a
- 100K image file that can be accessed, then the partition should be at least 300K. It may
- run with considerably less though. The memory requirements can depend on many variables.
-
- The best way to find out the ideal partition size is to start httpd4Mac with the debug
- option on with verbose messages, then force it to quit immediately. If you do not have
- a process management utility, then just restart your Mac. When you examine the debug log
- file you will see some lines showing a memory analysis. As long as there is enough free
- memory to hold the largest file you expect to serve, plus a bit spare (say 10%/5K which
- ever is larger, this will probably do. However you will get better results the more memory
- you allocate.
-
- UNEXPECTED FEATURES
-
- 1. Make sure the multifinder partition is big enough (see memory above). Because httpd
- caches objects retrieved it need a certain amount of memory to do that. Objects cannot be
- cached in bits they have to be cached whole. This is why the size of the biggest object that
- be served out comes into the equation for determining the memory partition. This may be
- fixed in the future. Failure to do this may give strange results or crashes.
-
- 2. At present there is nothing to stop you reuqesting the debug info or prefs file (or even
- httpd4Mac itself !). Such action might have some very weird if not dangerous results, I would
- not recommend it.
-
- 3. httpd4Mac takes a little time to get going. Usually access is not possible until about 10 seconds
- or so after start-up. The reason is because httpd4Mac relinquishes control ASAP, the idea being
- if it is in your startup items folder, the boot process does not appear to be slowed down by it.
-
- 4. httpd4Mac uses a crude caching mechanism to store files that have previously been requested.
- Basically an item is cached until the copy is a certain age, no check is made to see if the file
- has changed. This is fine if you do not change the pages pages often, but if you do you may
- wish to set this lifetime to a lower value. A better caching system will be in future versions.
- The cache life is controlled in the prefs file.
-
- ABOUT THE CODE DEVELOPMENT
-
- This is my first TCP programme. It was developed on Think C v6. I made use of some
- utilities, which you also find useful if you have any problems
-
- MacsBug - Apples low level debugger
- ZapTCP - Apple extension, helps when TCP apps crash unexpectedely
- MacTCPwatcher - Utility from Peter Lewis for testing MacTCP functions
- ZoneRanger - Utility from Joshua Golub, used for examing memory
- ProcessFinder - Utility from Edward Harp, used to kill the background app without rebooting
-
- I will release the source code for this app later, when I have had a chance to tidy it
- up a bit.
-
- It was developed on a Mac IIci, running Sys 7.1, MacTCP 2.0.4, with 20Meg of RAM. You
- won't need that much though. It will not run on a 68000 machine. It does not use any
- floating point code. It has also been run (although not for very long) on a Centris
- 610, again Sysy 7.1, MacTCP 2.0.4
-
- FIXES/IMPROVEMENTS FROM 1.0a TO 1.1a (Released 17 Jan 1995)
-
- - You now get a notification telling you when httpd is running and ready for access.
- - An option to limit the life of cached items is now in the prefs file.
- - Bug fixed that meant if you requested a URL with lower 'ASCII-value' than the first
- request of the day it crashed. By ASCII-value I mean comparing the ASCII values of
- the individual characters as you would if you were sorting alphabetically.
- ie 'bug' < 'home' and 'help' < 'home'
-
- FIXES/IMPROVEMENTS FROM 1.1a TO 1.2a (Released 28 Feb 1995)
-
- - A bug that caused a bus error when httpd4Mac quits is gone.
- - HEAD method is now supported
- - MIME support
- - Access logging is done, with DNS lookup if needed.
- - URLs are no longer case sensitive.
- - Change of format of debugging file, more messages added. Each line now peceeded with
- function name
- - Some general improvements in the way some things are done.
-
- NEW VERSIONS
-
- I will always place new versions on the info-mac archives at Stanford. I do not plan to
- post them elsewhere yet, so latest copies can be obtained there.
-
- COMMENTS/PROBLEMS
-
- httpd4Mac is my first piece of freeware and I would be pleased to know it is being used at all.
- Please send me any comments you have. Of course useful comments that would lead to bug fixing
- would be appreciated. I always read my E-Mail and I usually reply. You can always send me
- a postcard. However if I get loads of E-Mail, I may not be able to reply. It may be better
- to post on USENet. I often read comp.sys.mac.comm, plus c.s.m.programmer and sometimes post.
-
- I rarely read newsgroups about WWW.
-
- I have sometimes referred to this program as shareware, sorry if that has caused confusion. It
- is freeware, you have no obligation to me regardless of what you want to use it for, but it
- would be nice to hear from you.
-
- Bill Melotti
- Rm2.09, R68
- Rutherford Appleton Laboratory
- Chilton, Nr Didcot
- OXON
- OX11 OQX
- UNITED KINGDOM
- --------------------------------
-
- Bill Melotti 28 Feb 1995
-
-
- bill.melotti@rl.ac.uk
-
-
- -- End of file --